package com.huyanqi.front.rest.resource.impl;

import java.util.List;

import javax.annotation.Resource;

import com.huyanqi.core.RetdObj;
import com.huyanqi.entity.Course;
import com.huyanqi.front.rest.RespCode;
import com.huyanqi.front.rest.resource.CourseListResource;
import com.huyanqi.front.rest.resp.CourseListResp;
import com.huyanqi.front.rest.service.CourseRestService;

public class CourseResourceImpl implements CourseListResource{

	private CourseRestService restService;
	
	@Resource(name="CourseRestService")
	public void setRestService(CourseRestService restService) {
		this.restService = restService;
	}
	public CourseRestService getRestService() {
		return restService;
	}
	
	@Override
	public CourseListResp findCourseByCsid(Long diyid) {
		CourseListResp csr = new CourseListResp();
		RetdObj<List<Course>> retd = restService.findCourseByCsid(diyid);
		csr.setData(retd.getRealObj());
		csr.setCode(RespCode.valueOf(retd.getCode()));
		return csr;
	}
	
}
